package com.wdemo.enums;

/**
 * @ClassName ChatTypeEnum
 * @Description 会话类型枚举类
 * @Author WDEMO
 * @Date 2025/8/20 20:14
 */
public enum ChatTypeEnum {

    CHAT("CHAT","会话类型"),
    SERVICE("SERVICE","客服类型"),
    PDF("PDF","pdf类型");

    private final String type;

    private final String name;

    ChatTypeEnum(String type, String name) {
        this.type = type;
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public String getName() {
        return name;
    }

    public static ChatTypeEnum fromString(String type) {
        for (ChatTypeEnum chatType : ChatTypeEnum.values()) {
//            判断当前枚举常量的名称是否与传入的字符串 type 忽略大小写相等。
            if (chatType.name().equalsIgnoreCase(type)) {
                return chatType;
            }
        }
        throw new IllegalArgumentException("Unsupported chat type: " + type);
    }
}
